function execTDENewsletter()
 {
    var namefield = document.tdenewsletter.namefield.value;
    var email = document.tdenewsletter.email.value;
	var p = email.indexOf('@');
    if (p < 1 || p == (email.length-1))
	{
	    alert('Please, enter a valid email address.');
		return false;
	}	
	var act = tdenws_getRadioValue("task");
	var http_request = tdenws_getRequest();
	http_request.open("GET", '/TDE_Newsletter/admin/subscribeaction.php?task='+act+'&email='+email+'&name='+namefield, false);
    http_request.send(null);
    alert(http_request.responseText);
	return false;
 }
 function tdenws_getRadioValue (field)
 {
    for(i=0;i < document.tdenewsletter.elements.length;i++)       
        if (document.tdenewsletter.elements[i].type == "radio" && document.tdenewsletter.elements[i].name == field && document.tdenewsletter.elements[i].checked)     
            return document.tdenewsletter.elements[i].value;
    return '';
 }
 function tdenws_getRequest()
 {
	  http_request = false;
	  if (window.XMLHttpRequest) { // Mozilla, Safari,...
		 http_request = new XMLHttpRequest();
		 if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/html');
		 }
	  } else if (window.ActiveXObject) { // IE
		 try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		 } catch (e) {
			try {
			   http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		 }
	  }
	  if (!http_request) {
		 alert('Cannot create XMLHTTP instance');
		 return false;
	  }
	  return http_request;
 }